package com.cy;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
public class ScaProviderApplication {
    public static void main(String[] args) {
        SpringApplication.run(ScaProviderApplication.class, args);
    }
    @Value("${server.port}")
    private String server;
    @RefreshScope
    @RestController
    public class ProviderController{
        @GetMapping("/provider/echo/{msg}")
        public String doEcho(@PathVariable String msg){
            return server+"say hello"+msg;
        }
        @Value("${logging.level.com.cy}")
        private String logLevel;
        @Value("${server.tomcat.threads.max}")
        private String maxThreads;
        @GetMapping("/doGetTomcatThreads")
        public String doGetTomcatThreads(){
            return maxThreads;
        }
        @GetMapping("/doGetLevel")
        public String doGetLevel(){
            return logLevel;
        }
        @Value("${page.pageSize}")
        private Integer page;
        @GetMapping("/doGetPage")
        public Integer doGetPage(){
            return page;
        }


    }
}
